
/******************************************************下拉框*****************************************************/
_$.PopupIconCls=function (target){
    var _this = this;
    _$.PopupIconCls.superclass.constructor.call(_this,target);
};
_$.regClass("PopupIconCls",_$.PopupIconCls);

_$.extend(_$.PopupIconCls,_$.Popup, {
    _cls:_$._clsPre + "PopupIconCls",
    _uiCls:_$._uiPreCls + "PopupIconCls",
    _attrProps:function(){
        var _this = this;
        var properties = _$.PopupIconCls.superclass._attrProps.call(_this);
        properties.addAll(["onchange","url"]);
        return properties;
    },
    _attrOpts:function(){
        var _this = this;
        var opts = _$.PopupIconCls.superclass._attrOpts.call(_this);
        return $.extend(true,opts,{
            "path":"/lib/cc",
            "url":"/html/iconCls.html"
        });
    },
    _initDialog:function(){
        var _this = this;
        _this.popup_bar.click(function(){
            var path = _this.getOption("path");
            var url = _this.getOption("url");

            url = path + url;
            var width = '400px';
            var height = '600px';

            $.cc.open({
                type : 2, //page层
                area : [ width, height ],
                title : '选择图标',
                maxmin : true,
                shade : 0.2, //遮罩透明度
                moveType : 1, //拖拽风格，0是默认，1是传统拖动
                content : url,
                btn : [ '确认','清除', '取消' ],
                yes : function(index, layero) {//确认按钮调用yes方法  取消按钮的方法为cancel
                    var win = getTopWindow();
                    var iframeWin = win[layero.find('iframe')[0]['name']];
                    var iconCls = iframeWin.getIconCls(index);
                    _this.setValue(iconCls);
                    $.cc.close(index);
                },
                btn2 : function(index, layero) {//确认按钮调用yes方法  取消按钮的方法为cancel
                    _this.setValue(null);
                    $.cc.close(index);
                }
            });
        })
    },
    setValue:function(value,change){

        var _this = this;
        if(isEmpty(change)){
            change = true;
        }
        if(isEmpty(value)){
            _this.value = null;
            _this.popup_input.html("");
        }else{
            _this.value = value;
            var _html = '<span class="glyphicon '+value+'" aria-hidden="true"></span>';
            _this.popup_input.html(_html);
        }

        if(change){
            _this._fire("onchange");
        }
    },
    _setStyle:function(){
        var _this = this;
        var width = _this.getOption('width');
        if(isNotEmpty(width)){
            _this.component.css({
                "width":width + "px"
            });
        }
    }
});